<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品列表</title>
    <#-- 通用样式-->
    <#include "../common/head.ftl">
</head>
<body>

<div id="wrapper" class="toggled">

    <#--边栏sidebar-->
    <#include "../common/nav.ftl">

    <#--主要内容content-->
    <div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row clearfix">
                <!-- 表格 -->
                <div class="col-md-12 column">
                    <table class="table table-bordered table-condensed">
                        <thead>
                        <tr>
                            <th>商品id</th>
                            <th>名称</th>
                            <th>图片</th>
                            <th>单价</th>
                            <th>库存</th>
                            <th>描述</th>
                            <th>类目</th>
                            <th colspan="2">操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        <#list productList as product>
                        <tr>
                            <td>${product.id}</td>
                            <td>${product.name}</td>
                            <td><img height="100" width="100" src="${product.icon}" alt=""></td>
                            <td>${product.price}</td>
                            <td>${product.stock}</td>
                            <td>${product.description}</td>
                            <td>${product.categoryType}</td>
                            <td><a href="/seller/product/addOrUpdateInfo?id=${product.id}">修改</a></td>
                            <td>
                                <#if product.getProductStatusEnum().message == "在架">
                                    <a href="/seller/product/offSale?id=${product.id}">下架</a>
                                <#else>
                                    <a href="/seller/product/onSale?id=${product.id}">上架</a>
                                </#if>
                            </td>
                        </#list>
                        </tr>
                        </tbody>
                    </table>
                </div>

                <!-- 分页 -->
                <div class="col-md-12 column">
                    <ul class="pagination">
                        <#if currentPage lte 1>
                            <li class="disabled"><a href="#">上一页</a></li>
                        <#else>
                            <li><a href="/seller/product/list?page=${currentPage - 1}&pageSize=${pageSize}">上一页</a></li>
                        </#if>

                        <#list 1..pageNum as index>
                            <#if currentPage == index>
                                    <li class="disabled"><a href="#">${index}</a></li>
                            <#else>
                                    <li><a href="/seller/product/list?page=${index}&pageSize=${pageSize}">${index}</a></li>
                            </#if>
                        </#list>

                        <#if currentPage gte pageNum>
                            <li class="disabled"><a href="#">下一页</a></li>
                        <#else>
                            <li><a href="/seller/product/list?page=${currentPage + 1}&pageSize=${pageSize}">下一页</a></li>
                        </#if>
                    </ul>
                </div>

            </div>
        </div>
    </div>
</div>

</body>
</html>